//找环的入口点
public class Solution1 {
    class ListNode {
        int value;
        ListNode next;

        public ListNode(int value) {
            this.value = value;
        }
    }
     public ListNode head;
    public ListNode detectCycle(ListNode head) {
        ListNode slow=head;
        ListNode fast=head;
        while(fast!=null&&fast.next!=null){
            fast=fast.next.next;
            slow=slow.next;
            if(fast==slow){
                break;
            }
        }
        if(fast==null||fast.next==null){
            return  null;
        }
        slow=head;
        while(slow!=fast){
            slow=slow.next;
            fast=fast.next;
            }
        return  fast;
        }
}